package com.myfoon.model.entryprocessor;

import com.tangosol.util.InvocableMap;
import com.tangosol.util.processor.AbstractProcessor;

import java.util.ArrayList;
import java.util.List;

public class EventPhotosAdder extends AbstractProcessor {
    private List<Long> eventPhotosList;
    
    public EventPhotosAdder() {
    }
    
    public EventPhotosAdder(List<Long> eventPhotosList) {
        this.eventPhotosList = eventPhotosList;
    }

    public Object process(InvocableMap.Entry entry) {
        if (entry == null) {
            return null;
        }
        
        List<Long> eventPhotos = null;
        if (entry.getValue() == null) 
            eventPhotos = new ArrayList<Long>();
        else {
            eventPhotos = (List<Long>)entry.getValue();
        }
        
        eventPhotos.addAll(eventPhotosList);        
        entry.setValue(eventPhotosList);
        
        return null;
    }

    public void setEventPhotosList(List<Long> eventPhotosList) {
        this.eventPhotosList = eventPhotosList;
    }

    public List<Long> getEventPhotosList() {
        return eventPhotosList;
    }
}
